package com.cn.learn.starter.service.impl;

import com.cn.learn.starter.service.ITimeService;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @ClassName TimeServiceImpl
 * @Description TODO
 * @Author JiJiang
 * @Date 2023/7/5 18:37
 * @Version 1.0
 */

public class TimeServiceImpl implements ITimeService {


    private SimpleDateFormat dateFormat;

    private Date date;

    {
        dateFormat = new SimpleDateFormat();
        date = new Date();
    }

    public TimeServiceImpl() {

    }


    @SuppressWarnings("all")
    @Override
    public String getTimeForYMDHIS(Long timestamp) {

        dateFormat.applyPattern("yyyy-MM-dd HH:mm:ss");
        date.setTime(timestamp);
        return dateFormat.format(date);


    }


}
